#include "OptionPanel_ShapeDetection.h"
#include <QtGui/QFileDialog>
#include "assert.h"

OCEANUI::CPanel_ShapeDetection::CPanel_ShapeDetection(QWidget* parent)
:	CPanelBase("CPanel_ShapeDetection",parent)
{

	pSquareFinder = new CSquareFinder();
}

bool OCEANUI::CPanel_ShapeDetection::init()
{
	setupUi(this);
	bool ConnectResult = QObject::connect(horizontalSlider,SIGNAL(valueChanged(int)),this,SLOT(OnValueChanged(int)),Qt::AutoConnection);
	assert(ConnectResult);
	ConnectResult = QObject::connect(btnTest,SIGNAL(clicked()),this,SLOT(OnTest()),Qt::DirectConnection);
	assert(ConnectResult);
	CPanelBase::init();
	return 0;
}

void OCEANUI::CPanel_ShapeDetection:: OnValueChanged(int value)
{
	pSquareFinder->thresholdChanged(value);
}

void OCEANUI::CPanel_ShapeDetection::OnTest()
{
	if (NULL != getImage())
	{
		IplImage *qi = pSquareFinder->fetchData();
		imageWindow.setImage(qi);
		imageWindow.show();
	}
	
}


 
OCEANUI::CPanel_ShapeDetection::~CPanel_ShapeDetection(void)
{
}
